package com.jihui.user.dao.impl;

import com.jihui.user.dao.UserDao;
import com.jihui.user.model.JihuiUser;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

@Repository
public class UserDaoImpl implements UserDao {
    private final Logger logger = Logger.getLogger(getClass());

    private final UserMapper userMapper;

    @Autowired
    public UserDaoImpl(UserMapper userMapper) {
        this.userMapper = userMapper;
    }


    @Override
    public void sayHello(String name) {
        logger.info(name);
    }

    @Override
    public void save(JihuiUser jihuiUser) {
        userMapper.save(jihuiUser);
    }


    @Nullable
    @Override
    public JihuiUser findById(Long primaryKey) {
        return userMapper.findById(primaryKey);
    }

    @Override
    public JihuiUser findByUsername(String username) {
        return userMapper.findByUsername(username);
    }

}
